package net.zwet.clanworks.connectors.eve.api.converter;

import net.zwet.clanworks.connectors.eve.jaxb.server.serverstatus.Eveapi;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * User: hansz
 * Date: 11/29/12
 * Time: 3:17 PM
 * To change this template use File | Settings | File Templates.
 */
public class ServerStatusConverter {
    private Eveapi serverStatus = new Eveapi();

    public Eveapi getResult(File file) {
        JAXBContext jaxbContext = null;
        try {
            jaxbContext = JAXBContext.newInstance(Eveapi.class);
            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            return serverStatus = (Eveapi) jaxbUnmarshaller.unmarshal(file);
        } catch (JAXBException e) {
            return null;  //To change body of implemented methods use File | Settings | File Templates.
        }
    }
}
